package com.yanqu.road.entity.hunt;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class UserHunt extends DataObject {

	private long userId;
	/**
	 * 怪物波数
	 */
	private int monsterIndex;
	/**
	 * boss被打掉血量
	 */
	private BigInteger monsterLoseBlood = BigInteger.ZERO;

	private long modifyTime;

	private int openBoxTimes;            //今天开宝箱次数

	private List<String> openHuntBoxUidList = new ArrayList<>();

	private BigInteger huntScore = BigInteger.ZERO;

	private int maxLevel;			//最高的打过的层数

	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		if(this.userId != userId) {
			this.userId = userId;
			setUpdateOption();
		}
	}

	public int getMonsterIndex() {
		return monsterIndex;
	}

	public void setMonsterIndex(int monsterIndex) {
		if(this.monsterIndex != monsterIndex) {
			this.monsterIndex = monsterIndex;
			setUpdateOption();
		}
	}

	public BigInteger getMonsterLoseBlood() {
		return monsterLoseBlood;
	}

	public void setMonsterLoseBlood(BigInteger monsterLoseBlood) {
		if(!Objects.equals(this.monsterLoseBlood, monsterLoseBlood)) {
			this.monsterLoseBlood = monsterLoseBlood;
			setUpdateOption();
		}
	}

	public int getOpenBoxTimes() {
		return openBoxTimes;
	}

	public void setOpenBoxTimes(int openBoxTimes) {
		if(this.openBoxTimes != openBoxTimes) {
			this.openBoxTimes = openBoxTimes;
			setUpdateOption();
		}
	}

	public long getModifyTime() {
		return modifyTime;
	}

	public void setModifyTime(long modifyTime) {
		if(this.modifyTime != modifyTime) {
			this.modifyTime = modifyTime;
			setUpdateOption();
		}
	}

	public List<String> getOpenHuntBoxUidList() {
		return openHuntBoxUidList;
	}

	public String getOpenHuntBoxUidListString(){
		return StringUtils.listToString(openHuntBoxUidList, ',');
	}

	public void setOpenHuntBoxUidList(List<String> openHuntBoxUidList) {
		this.openHuntBoxUidList = openHuntBoxUidList;
		setUpdateOption();
	}

	public boolean isOpenHuntBox(String huntBoxUid){
		return openHuntBoxUidList.contains(huntBoxUid);
	}

	public void addOpenHuntBox(String huntBoxUid){
		if(!isOpenHuntBox(huntBoxUid)){
			openHuntBoxUidList.add(huntBoxUid);
		}
	}

	public BigInteger getHuntScore() {
		return huntScore;
	}

	public void setHuntScore(BigInteger huntScore) {
		if(!Objects.equals(this.huntScore, huntScore)) {
			this.huntScore = huntScore;
			setUpdateOption();
		}
	}

	public int getMaxLevel() {
		return maxLevel;
	}

	public void setMaxLevel(int maxLevel) {
		if (this.maxLevel != maxLevel){
			this.maxLevel = maxLevel;
			setUpdateOption();
		}
	}
}
